package com.example.quce.controller;

import com.example.quce.common.R;
import com.example.quce.entity.Blog;
import com.example.quce.mapper.BlogMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/blog")
@RequiredArgsConstructor
public class BlogController {
    @Autowired
    BlogMapper blogMapper;

    @GetMapping("/selectBlogById/{id}")
    public R selectBlogById(@PathVariable("id") int id) {
        // 读取person表中所有数据
        Blog blog=new Blog();
        blog=this.blogMapper.selectBlogById(id);
        // 把从数据库中读取的结果传回前端
        return R.ok(blog);
    }

}
